import 'package:flutter/material.dart';
import '../utils/base.dart';


class SplashScreen extends StatefulWidget {
  SplashScreen({Key key}) : super(key: key);

  _SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
  @override
  void initState() {
    super.initState();
    Future.delayed(Duration(seconds: 5)).then((_) {
      Navigator.of(context).pushReplacementNamed('/homepage');
    });
  }

  //styles:S
  //样式-加载文本
  TextStyle styleLoading() {
    return TextStyle(
        fontSize: Design.px(26),
        color: HexColor("666666"),
        decoration: TextDecoration.none);
  }
  //styles:E

  @override
  Widget build(BuildContext context) {
    return Container(
        decoration: new BoxDecoration(color: HexColor('FFFFFF')),
        child: Column(
          children: <Widget>[
            Expanded(
              child: Container(
                alignment: Alignment.center,
                child: Image.asset('assets/logo.png', width: Design.px(300), height: Design.px(300)),
              ),
              flex: 2,
            ),
            Expanded(
              child: Container(
                alignment: Alignment.center,
                child: Text(
                  '初始化中...',
                  style: styleLoading(),
                ),
              ),
              flex: 1,
            )
          ],
        ));
  }
}
